package com.base.interview.devtest.api;

import com.base.interview.devtest.model.ResponseModel;
import com.base.interview.devtest.model.dto.UserDTO;
import com.base.interview.devtest.model.dto.UserLoginDTO;
import com.base.interview.devtest.model.dto.UserLogoutDTO;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/api/users")
public interface IUserApi {
    @ApiOperation(value = "Register User", nickname = "registerUser", response = ResponseModel.class, tags = {"user"})
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "OK", response = ResponseModel.class),
            @ApiResponse(code = 401, message = "Authorization Required", response = ResponseModel.class),
            @ApiResponse(code = 403, message = "Authorization Failed", response = ResponseModel.class),
            @ApiResponse(code = 500, message = "Internal Server Error", response = ResponseModel.class)
    })
    @GetMapping("/status")
    ResponseEntity<ResponseModel> status();

    @ApiOperation(value = "Register User", nickname = "registerUser", response = ResponseModel.class, tags = {"user"})
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "OK", response = ResponseModel.class),
            @ApiResponse(code = 401, message = "Authorization Required", response = ResponseModel.class),
            @ApiResponse(code = 403, message = "Authorization Failed", response = ResponseModel.class),
            @ApiResponse(code = 500, message = "Internal Server Error", response = ResponseModel.class)
    })
    @PostMapping("/register")
    ResponseEntity<ResponseModel> register(@RequestBody UserDTO userDTO);

    @ApiOperation(value = "User Login", nickname = "userLogin", response = ResponseModel.class, tags = {"user"})
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "OK", response = ResponseModel.class),
            @ApiResponse(code = 401, message = "Authorization Required", response = ResponseModel.class),
            @ApiResponse(code = 403, message = "Authorization Failed", response = ResponseModel.class),
            @ApiResponse(code = 500, message = "Internal Server Error", response = ResponseModel.class)
    })
    @PostMapping("/login")
    ResponseEntity<ResponseModel> login(@RequestBody UserLoginDTO userLoginDTO);

    @ApiOperation(value = "User Logout", nickname = "userLogout", response = ResponseModel.class, tags = {"user"})
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "OK", response = ResponseModel.class),
            @ApiResponse(code = 401, message = "Authorization Required", response = ResponseModel.class),
            @ApiResponse(code = 403, message = "Authorization Failed", response = ResponseModel.class),
            @ApiResponse(code = 500, message = "Internal Server Error", response = ResponseModel.class)
    })
    @PostMapping("/logout")
    ResponseEntity<ResponseModel> logout(@RequestBody UserLogoutDTO userLogoutDTO);

    @ApiOperation(value = "Follow User", nickname = "followUser", response = ResponseModel.class, tags = {"user"})
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "OK", response = ResponseModel.class),
            @ApiResponse(code = 401, message = "Authorization Required", response = ResponseModel.class),
            @ApiResponse(code = 403, message = "Authorization Failed", response = ResponseModel.class),
            @ApiResponse(code = 500, message = "Internal Server Error", response = ResponseModel.class)
    })
    @PostMapping("/{userId}/follow")
    ResponseEntity<ResponseModel> follow(@PathVariable(name = "userId") Long userId);

    @ApiOperation(value = "Un-Follow User", nickname = "unFollowUser", response = ResponseModel.class, tags = {"user"})
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "OK", response = ResponseModel.class),
            @ApiResponse(code = 401, message = "Authorization Required", response = ResponseModel.class),
            @ApiResponse(code = 403, message = "Authorization Failed", response = ResponseModel.class),
            @ApiResponse(code = 500, message = "Internal Server Error", response = ResponseModel.class)
    })
    @PostMapping("/{userId}/unfollow")
    ResponseEntity<ResponseModel> unfollow(@PathVariable(name = "userId") Long userId);

    @ApiOperation(value = "List Followers", nickname = "listFollowers", response = ResponseModel.class, tags = {"user"})
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "OK", response = ResponseModel.class),
            @ApiResponse(code = 401, message = "Authorization Required", response = ResponseModel.class),
            @ApiResponse(code = 403, message = "Authorization Failed", response = ResponseModel.class),
            @ApiResponse(code = 500, message = "Internal Server Error", response = ResponseModel.class)
    })
    @GetMapping("/{userId}/followers")
    ResponseEntity<ResponseModel> listFollowers(@PathVariable(name = "userId") Long userId);

    @ApiOperation(value = "List Followed", nickname = "listFollowed", response = ResponseModel.class, tags = {"user"})
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "OK", response = ResponseModel.class),
            @ApiResponse(code = 401, message = "Authorization Required", response = ResponseModel.class),
            @ApiResponse(code = 403, message = "Authorization Failed", response = ResponseModel.class),
            @ApiResponse(code = 500, message = "Internal Server Error", response = ResponseModel.class)
    })
    @GetMapping("/{userId}/followed")
    ResponseEntity<ResponseModel> listFollowed(@PathVariable(name = "userId") Long userId);

    @ApiOperation(value = "List Followers", nickname = "listFollowers", response = ResponseModel.class, tags = {"user"})
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "OK", response = ResponseModel.class),
            @ApiResponse(code = 401, message = "Authorization Required", response = ResponseModel.class),
            @ApiResponse(code = 403, message = "Authorization Failed", response = ResponseModel.class),
            @ApiResponse(code = 500, message = "Internal Server Error", response = ResponseModel.class)
    })
    @GetMapping("/{userId}/followers/count")
    ResponseEntity<ResponseModel> followersCount(@PathVariable(name = "userId") Long userId);

    @ApiOperation(value = "List Followed", nickname = "listFollowed", response = ResponseModel.class, tags = {"user"})
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "OK", response = ResponseModel.class),
            @ApiResponse(code = 401, message = "Authorization Required", response = ResponseModel.class),
            @ApiResponse(code = 403, message = "Authorization Failed", response = ResponseModel.class),
            @ApiResponse(code = 500, message = "Internal Server Error", response = ResponseModel.class)
    })
    @GetMapping("/{userId}/followed/count")
    ResponseEntity<ResponseModel> followedCount(@PathVariable(name = "userId") Long userId);

    @ApiOperation(value = "Search User", nickname = "searchUser", response = ResponseModel.class, tags = {"user"})
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "OK", response = ResponseModel.class),
            @ApiResponse(code = 401, message = "Authorization Required", response = ResponseModel.class),
            @ApiResponse(code = 403, message = "Authorization Failed", response = ResponseModel.class),
            @ApiResponse(code = 500, message = "Internal Server Error", response = ResponseModel.class)
    })
    @GetMapping("/search/{username}")
    ResponseEntity<ResponseModel> search(@PathVariable(name = "username") String username);
}
